package com.tymoshenko.seabattle.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.tymoshenko.seabattle.client.presenter.NewGamePresenter;
import com.tymoshenko.seabattle.client.presenter.ShipPlacementPresenterImpl;
import com.tymoshenko.seabattle.client.presenter.ShootingPresenterImpl;
import com.tymoshenko.seabattle.client.view.DashboardView;
import com.tymoshenko.seabattle.client.view.DashboardViewImpl;
import com.tymoshenko.seabattle.shared.model.domain.Account;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class SeaBattle implements EntryPoint {

    public void onModuleLoad() {
        Account human = new Account("Human", "");
        Account computer = new Account("Computer", "");
        ClientFactory clientFactory = new ClientFactory();
        clientFactory.setAccount1(human);
        clientFactory.setAccount2(computer);

        DashboardViewImpl dashboardView = new DashboardViewImpl();
        dashboardView.setClientFactory(clientFactory);
        DashboardView.NewGamePresenter newGamePresenter = new NewGamePresenter(dashboardView);
        DashboardView.ShipPlacementPresenter shipPlacementPresenter = new ShipPlacementPresenterImpl(dashboardView, clientFactory);
        DashboardView.ShootingPresenter shootingPresenter = new ShootingPresenterImpl(dashboardView, clientFactory);

        RootPanel.get().add(dashboardView);
        newGamePresenter.startNewGame();
    }
}
